<template>
  <view>
    <view class="tabs-container">
      <view class="tabs-item" @click="onClick(index)" :class="{'tbs-item-choose': chooseIndex == index}"
        v-for="(item,index) in list" :key="index">
        {{ item }}
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    props: {
      list: Array
    },
    data() {
      return {
        chooseIndex: 0, //当前选中下标
      };
    },
    methods: {
      onClick(index) {
        this.chooseIndex = index
        this.$emit("sort", index)
      }

    }
  }
</script>

<style lang="scss">
  .tabs-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: #ffffff;

    .tabs-item {
      height: 90rpx;
      line-height: 90rpx;
    }

    .tbs-item-choose {
      color: red;
    }
  }
</style>